'use strict';

const Fund = require('./reptile/fund');
const { cookie } = require('./reptile/utils/constant');

module.exports = {
  get fund() {
    return new Fund(this.requestReptile.bind(this));
  },
  async requestReptile(url, dataType = 'json') {
    const res = await this.curl(url, { dataType, headers: { cookie } });
    return res.data;
  },
  result(data = null, code = 0, message = '数据获取成功') {
    this.body = {
      code,
      data,
      message,
    };
  },

  resultFail(message = '数据获取失败') {
    this.result(null, 1, message);
  },
};
